/*
    The I Ching (the Book of Changes) plasmoid.
    Copyright (C) 2002-2009 Jean Pierre Charalambos.
    TrigramSelector Jorge Andrés Martínez

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/
#ifndef TRIGRAMSELECTOR_H
#define TRIGRAMSELECTOR_H

//QT
#include <QWidget>

//Plasma
#include <Plasma/SvgWidget>
#include <Plasma/Svg>

class TrigramSelector : public QGraphicsWidget {
        Q_OBJECT
  public :
    TrigramSelector(QGraphicsWidget* parent);
    QString getSelected();
  signals:
    void textChanged(QString text);
    
  private :
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
    QString positionToTrigram(QPointF pos);
    qreal getTrigramAngle(QString name);
    QPointF trigramToPosition(QString name);
    QRectF getTrigramDimentions(QString name);
    
    Plasma::Svg *trigamsSvg;
    QString selected;//trigrama seleccionado
    
    //Posiciones de los elementos.
    QRectF liBounds;
    QRectF sunBounds;
    QRectF chienBounds;
    QRectF tuiBounds;
    QRectF kanBounds;
    QRectF chenBounds;
    QRectF kunBounds;
    QRectF kenBounds;
    QRectF taijituBounds;
};

#endif // TRIGRAMSELECTOR_H
